Devices may include or be coupled to one or more digital cameras to capture images and video, and the camera sensor of a digital camera has a fixed orientation compared to the device. For example, a smartphone or tablet includes one or more cameras on the back (opposite the side with the display) and one or more cameras on the front (on the side with the display), and the cameras in a smartphone or tablet are fixed with the camera sensors having a fixed orientation relative to the smartphone or tablet.
When a device is to be used to capture an image or video, the device may be oriented in different ways. For example, a user may orient vertically a smartphone for capturing portraits and orient horizontally a smartphone for capturing landscapes. Since the camera sensor has a fixed orientation relative to the device, and the device may be rotated or placed in different orientations for capture, the orientation of a captured image from the camera sensor may have a different orientation than the user. For example, if a device is held upside down by a user when capturing an image, the captured image from the camera sensor may be upside down when displaying the captured image to the user or when storing the image in memory.
To compensate for differences in orientation between a user and the captured images, a device may adjust the orientation of the image after capture and during the image processing pipeline. For example, a device may use an accelerometer to attempt to determine the device orientation during capture and adjust the orientation of the captured image based on the determined device orientation. However, there are some situations where the device is unable to determine its orientation, or the orientation may be incorrect such that the adjusted orientation of a captured image is incorrect.